home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / ADA / GNAT / !gcc / adainc / 2 / adb / a-tiinio < prev    next >
Text File  |  1996-02-12  |  5KB  |  138 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --               A D A . T E X T _ I O . I N T E G E R _ I O                --
  6. --                                                                          --
  7. --                                 B o d y                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.3 $                              --
  10. --                                                                          --
  11. --     Copyright (C) 1992,1993,1994,1995 Free Software Foundation, Inc.     --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
  22. -- MA 02111-1307, USA.                                                      --
  23. --                                                                          --
  24. -- As a special exception,  if other files  instantiate  generics from this --
  25. -- unit, or you link  this unit with other files  to produce an executable, --
  26. -- this  unit  does not  by itself cause  the resulting  executable  to  be --
  27. -- covered  by the  GNU  General  Public  License.  This exception does not --
  28. -- however invalidate  any other reasons why  the executable file  might be --
  29. -- covered by the  GNU Public License.                                      --
  30. --                                                                          --
  31. -- GNAT was originally developed  by the GNAT team at  New York University. --
  32. -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
  33. --                                                                          --
  34. ------------------------------------------------------------------------------
  35.  
  36. with Ada.Text_IO.Integer_Aux;
  37.  
  38. package body Ada.Text_IO.Integer_IO is
  39.  
  40.    package Aux renames Ada.Text_IO.Integer_Aux;
  41.  
  42.    ---------
  43.    -- Get --
  44.    ---------
  45.  
  46.    procedure Get
  47.      (File  : in File_Type;
  48.       Item  : out Num;
  49.       Width : in Field := 0)
  50.    is
  51.    begin
  52.       if Num'Size > Integer'Size then
  53.          Aux.Get_LLI (File, Long_Long_Integer (Item), Width);
  54.       else
  55.          Aux.Get_Int (File, Integer (Item), Width);
  56.       end if;
  57.  
  58.    exception
  59.       when Constraint_Error => raise Data_Error;
  60.    end Get;
  61.  
  62.    procedure Get
  63.      (Item  : out Num;
  64.       Width : in Field := 0)
  65.    is
  66.    begin
  67.       if Num'Size > Integer'Size then
  68.          Aux.Get_LLI (Current_In, Long_Long_Integer (Item), Width);
  69.       else
  70.          Aux.Get_Int (Current_In, Integer (Item), Width);
  71.       end if;
  72.  
  73.    exception
  74.       when Constraint_Error => raise Data_Error;
  75.    end Get;
  76.  
  77.    procedure Get
  78.      (From : in String;
  79.       Item : out Num;
  80.       Last : out Positive)
  81.    is
  82.    begin
  83.       if Num'Size > Integer'Size then
  84.          Aux.Gets_LLI (From, Long_Long_Integer (Item), Last);
  85.       else
  86.          Aux.Gets_Int (From, Integer (Item), Last);
  87.       end if;
  88.  
  89.    exception
  90.       when Constraint_Error => raise Data_Error;
  91.    end Get;
  92.  
  93.    ---------
  94.    -- Put --
  95.    ---------
  96.  
  97.    procedure Put
  98.      (File  : in File_Type;
  99.       Item  : in Num;
  100.       Width : in Field := Default_Width;
  101.       Base  : in Number_Base := Default_Base)
  102.    is
  103.    begin
  104.       if Num'Size > Integer'Size then
  105.          Aux.Put_LLI (File, Long_Long_Integer (Item), Width, Base);
  106.       else
  107.          Aux.Put_Int (File, Integer (Item), Width, Base);
  108.       end if;
  109.    end Put;
  110.  
  111.    procedure Put
  112.      (Item  : in Num;
  113.       Width : in Field := Default_Width;
  114.       Base  : in Number_Base := Default_Base)
  115.    is
  116.    begin
  117.       if Num'Size > Integer'Size then
  118.          Aux.Put_LLI (Current_Out, Long_Long_Integer (Item), Width, Base);
  119.       else
  120.          Aux.Put_Int (Current_Out, Integer (Item), Width, Base);
  121.       end if;
  122.    end Put;
  123.  
  124.    procedure Put
  125.      (To   : out String;
  126.       Item : in Num;
  127.       Base : in Number_Base := Default_Base)
  128.    is
  129.    begin
  130.       if Num'Size > Integer'Size then
  131.          Aux.Puts_LLI (To, Long_Long_Integer (Item), Base);
  132.       else
  133.          Aux.Puts_Int (To, Integer (Item), Base);
  134.       end if;
  135.    end Put;
  136.  
  137. end Ada.Text_IO.Integer_IO;
  138.